﻿<!doctype html>
 <html lang="zh-CN">
 <head>
   <meta charset="UTF-8">
   <link rel="stylesheet" href="../../../css/common.css">
   <link rel="stylesheet" href="../../../css/main.css">
   <script type="text/javascript" src="../../../js/jquery.min.js"></script>
   <script type="text/javascript" src="../../../js/colResizable-1.3.min.js"></script>
   <script type="text/javascript" src="../../../js/common.js"></script>

  <script type="text/javascript">
    function del(){
	  confirm("确认删除");
	}
	function delall(){
        confirm("确认删除");
	}
	function excel(){
	  confirm("确认导出");
	}
  </script>
</head>
<body>
     <div id="search_bar" class="mt10">
       <div class="box">
          <div class="box_border">
            <div class="box_top"><b class="pl15">通告列表</b></div>
            <div class="box_center pt10 pb10">
                <form action="/resource/tonggao/demo1/list" method="post">
                  <table class="form_table" border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td>名称</td>
                            <td><input type="text" name="annName" value="${annName}" class="input-text lh25" size="10"/></td>

                            <td>发布时间</td>
                            <td><input type="date" name="publishTimeBegin" value="${publishTimeBegin}" class="input-text lh25" size="10"/>to
                                <input type="date" name="publishTimeOver" value="${publishTimeOver}" class="input-text lh25" size="10"/></td>
                            <td><input type="submit" name="button" class="btn btn82 btn_search" value="查询"/>
                                <input type="reset" name="button" class="btn btn82 btn_recycle" value="清空"/></td>
                        </tr>
                    </table>
                </form>
            </div>
        
             <div  class="box_bottom pb5 pt5 pr10" style="border-top:1px solid #dadada;">
              <div class="search_bar_btn" style="text-align:center;" >
                 
                 <a href="/resource/tonggao/demo1/add" class="ext_btn"><span class="add"></span>添加通告</a>
              </div>
            </div>
			</div>
       </div>

 <div id="table" class="mt10">
        <div class="box span10 oh">
            <form action="/bathdelete" method="post">
                <input type="hidden" name="method" id="mymethod">
                <table width="100%" border="0" cellpadding="0" cellspacing="0" class="list_table">
                    <tr>
                        <th>序号</th>
                        <th> <input type="checkbox" id="btn1"/></th>
                        <th>名称</th>
                        <th>发布人</th>
                        <th>状态</th>
                        <th>发布时间</th>
                        <th>操作</th>
                    </tr>


                    <#list  all.list  as  all>
                        <tr class="tr" align="center">
                            <td>${all_index+1}</td>
                            <td class="td_center"><input type="checkbox" name="arr" value="${all.anId}"/></td>
                            <td><a href="/annunciatelook?anId=${all.anId}">${all.annName}</a></td>
                            <td>${all.realName}</td>
                            <#--                          <td>${all.status}</td>-->
                            <#if  (all.status==1)>
                                <td>发布</td>
                            </#if>
                            <#if  (all.status==0)>
                                <td>草稿</td>
                            </#if>
                            <#if  (all.status==-1)>
                                <td>已过期</td>
                            </#if>
                            <td>${all.publishTime?datetime}</td>
                            <td>

                                <#if  (all.status==0)>
                                    <a href="#" name="fabu" onclick="f(${all.anId})">发布</a>
                                </#if>
                                <#if  (all.status!=0)>
                                    <span style="color: #445566">发布</span>
                                </#if>
                                <a href="/updatefind?anId=${all.anId}">编辑</a>
<#--                                <#if  (all.status!=1)>-->
<#--                                    <a href="javascript:void(0)" onclick="del()">删除</a>-->
<#--                                </#if>-->
                            </td>
                        </tr>
                    </#list>
                    <tr>
                        <td colspan="2"><input type="button" name="button" class="btn btn82 btn_del" value="删除"  onclick="tosub()">
                            <input type="button" name="button"  class="btn btn82 btn_export" value="导出" onclick="todaochu()">
                        </td>
                        <td colspan="5" align="right">
                            <div class="page mt10">
                                <div class="pagination">
                                    <#--                                                                                        ${ (type == 'SPOT') ?string('热点词','热点搜索')}-->
                                    <ul >
                                        <li class="first-child"><a href="/resource/tonggao/demo1/list?page=1&annName=${annName}&publishTimeBegin=${publishTimeBegin}&publishTimeOver=${publishTimeOver}">首页</a></li>

                                        <li><a href="/resource/tonggao/demo1/list?page=${all.prePage}&annName=${annName}&publishTimeBegin=${publishTimeBegin}&publishTimeOver=${publishTimeOver}">上一页</a></li>

                                        <#--							  <li class="active"><span>1</span></li>-->
                                        <#--							  <li><a href="#">2</a></li>-->
                                        <#--							  <li><a href="#">3</a></li>-->
                                        <#--							  <li><a href="#">4</a></li>-->
                                        <li class=""><a href="/resource/tonggao/demo1/list?page=${(all.nextPage==0)?string('${all.pages}','${all.nextPage}')}&annName=${annName}&publishTimeBegin=${publishTimeBegin}&publishTimeOver=${publishTimeOver}">下一页</a></li>
                                        <li ><a href="/resource/tonggao/demo1/list?page=${all.pages}&annName=${annName}&publishTimeBegin=${publishTimeBegin}&publishTimeOver=${publishTimeOver}">末页</a></li>
                                        <li ><span>共${all.total}条数据</span></li>
                                        <li ><span>共${all.getPages()}页</span></li>
                                    </ul>
                                </div>
                            </div>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
     </div>

</body>

    <script type="text/javascript">

        var anId=-1
        function f(id){
            alert(id)
            anId=id;
        }

        $(function () {
            $("[name='fabu']").click(function () {
                alert("进来了吗")
                $.ajax({
                    url:"/changeStatus",
                    data:{anId:anId,status:1},
                    type:"post",
                    dataType:"json",
                    success:function(rs){
                        if(rs==1){
                            alert("修改成功!请刷新页面！")
                        }else{
                            alert("憨批，时间不到发布不了！")
                        }
                    }
                })
            })
        })


        $(function(){
            $("#btn1").click(function(){
                //1.得到点击按钮的状态  checked 属于js对象中的属性
                //jquery->js
                var state=$(this)[0].checked;
                //alert(state);
                //2.设置全选
                var cks=document.getElementsByName("arr");
                for(var i=0;i<cks.length;i++){
                    cks[i].checked=state;
                }
            });
        })

        //提交删除
        function  tosub() {
            document.getElementById("mymethod").value="delete";
            document.forms[1].submit();
        }

        //提交导出
        function todaochu(){
            //设置隐藏域的值
            document.getElementById("mymethod").value="daochu";
            //提交表单
            //  document.getElementById("myform").submit();
            document.forms[1].submit();
        }
    </script>
</html>